﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TLL.Log
{
    public class LogDate
    {
        private int id = 0;
        public DateTime? Date = null;
        public LogTime Time = LogTime.Empty;

        public int ID { get { return this.id; } }
        public LogDate() { }
        public LogDate(int id, DateTime date, LogTime time)
        {
            this.id = id;
            this.Date = date;
            this.Time = time;
        }
        public LogDate(DateTime date, LogTime time)
        {
            this.Date = date;
            this.Time = time;
        }
        public static string GetFormatedDate(string input, FormateDate dateformat)
        {
            var elements = input.Split(new char[] { '.' });
            if (input.Split(new char[] { '.' })[2] == DateTime.Now.Year.ToString())
                switch (dateformat)
                {
                    case FormateDate.DayMonth: return string.Format("{0}.{1}", elements[0], elements[1]); break;
                    case FormateDate.Day: return string.Format("{0}", elements[0]); break;
                    case FormateDate.MonthYear: return string.Format("{0}.{1}.{2}", elements[0], elements[1], elements[2]); break;
                    default: return string.Empty;
                }
            else
                return input;
        }
    }
}
